package com.runshu.newsmartark.adapter;

import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.runshu.newsmartark.R;
import com.runshu.newsmartark.entity.InventoryListEntity;

import java.util.List;

/**
 * Demo class
 *
 * @author yu
 * @date 2021/11/18
 * @decs：
 */

public class NewProDtaAdapter extends BaseQuickAdapter<InventoryListEntity.ListBean, BaseViewHolder> {


    public NewProDtaAdapter(@Nullable  List<InventoryListEntity.ListBean> data) {
        super(R.layout.item_take_stock, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, InventoryListEntity.ListBean item) {
        helper.setText(R.id.tv_no, String.valueOf(helper.getAdapterPosition() + 1));
        helper.setText(R.id.tv_pro_name, item.getGoodsName());

        if (TextUtils.isEmpty(item.getGoodsModel())) {
            helper.setVisible(R.id.tv_pro_guige, false);
        } else {
            helper.setVisible(R.id.tv_pro_guige, true);
            helper.setText(R.id.tv_pro_guige, "规格：" + item.getGoodsModel());
        }
//        helper.setText(R.id.tv_pro_company, "生产厂家：" + item.getManufacturer());
        helper.setText(R.id.tv_pro_num, String.valueOf(item.getStock()));
    }
}